package com.atguigu.guli.service.ucenter.controller.api;

import com.atguigu.guli.service.ucenter.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/api/ucenter/wx")
@Slf4j

public class ApiWxController {
    @Autowired
    MemberService memberService;

    //1、获取wx登录二维码 wx登录请求
    @GetMapping("login")
    public String wxlogin(HttpSession session) {
        return memberService.wxLogin(session);
    }

    @GetMapping("callback")
    public String callback(@RequestParam("code") String code, @RequestParam("state") String state, HttpSession session) {
        return memberService.wxCallback(code,state,session);
    }
}
